home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / usr / share / ubiquity / check-kernels < prev    next >
Text File  |  2008-10-29  |  1KB  |  47 lines

  1. #! /bin/sh
  2.  
  3. ARCH="$(dpkg --print-architecture)"
  4. SUBARCH="$(archdetect)"
  5. SUBARCH="${SUBARCH#*/}"
  6. CPUINFO=/proc/cpuinfo
  7. UNAME_R="$(uname -r)"
  8. KERNEL_MAJOR="$(echo "$UNAME_R" | cut -d . -f 1,2)"
  9. KERNEL_VERSION="$(echo "$UNAME_R" | cut -d - -f 1)"
  10. KERNEL_ABI="$(echo "$UNAME_R" | cut -d - -f 1,2)"
  11. MACHINE="$(uname -m)"
  12. NUMCPUS=
  13.  
  14. if [ -f /usr/lib/ubiquity/base-installer/kernel.sh ]; then
  15.     . /usr/lib/ubiquity/base-installer/kernel.sh
  16. else
  17.     exit 0
  18. fi
  19.  
  20. kernels="$(dpkg-query -f '${status} ${package}\n' -W linux-image-\* | \
  21.         grep '^install ok installed ' | cut -d' ' -f4 | xargs)"
  22.  
  23. flavour="$(arch_get_kernel_flavour || true)"
  24. incompatible=
  25. for kernel in $kernels; do
  26.     if ! arch_check_usable_kernel "$kernel" "$flavour"; then
  27.         if [ "${kernel%-$UNAME_R}" != "$kernel" ]; then
  28.             echo 'Would try to remove running kernel;' \
  29.                  'bailing out for sanity' >&2
  30.             exit 0
  31.         fi
  32.         incompatible="${incompatible:+$incompatible }$kernel"
  33.     fi
  34. done
  35.  
  36. if [ "$kernels" = "$incompatible" ]; then
  37.     # We must be wrong. After all, we got this far ...
  38.     echo 'No usable kernel found; assuming foreign package naming' >&2
  39. else
  40.     mkdir -p /var/lib/ubiquity
  41.     for kernel in $incompatible; do
  42.         echo "$kernel" >> /var/lib/ubiquity/remove-kernels
  43.     done
  44. fi
  45.  
  46. exit 0
  47.